
<%- include('./layouts/admin_head',{title:'Posts'});%>
<body>
  <script>NProgress.start()</script>

  <div class="main">
    <%- include('./layouts/admin_navbar');%>
    <div class="container-fluid">
      <div class="page-title">
        <h1>所有文章</h1>
        <a href="post-add.html" class="btn btn-primary btn-xs">写文章</a>
      </div>
      <!-- 有错误信息时展示 -->
      <!-- <div class="alert alert-danger">
        <strong>错误！</strong>发生XXX错误
      </div> -->
      <div class="page-action">
        <!-- show when multiple checked -->
        <a class="btn btn-danger btn-sm" href="javascript:;" style="display: none">批量删除</a>
        <form class="form-inline">
          <select name="" id="classify" class="form-control input-sm">
            <!-- <option value="">所有分类</option> -->
          </select>
          <select name="" id="status" class="form-control input-sm">
            <option value="all">所有状态</option>
            <option value="drafted">草稿</option>
            <option value="published">已发布</option>
            <option value="trashed">已作废</option>
          </select>
          <input class="btn btn-default btn-sm" id="filtrate" type="button" id="" value="筛选">
        </form>
        <ul class="pagination pagination-sm pull-right">
          <!-- <li class="page-item" ><a class="page-link" href="#">上一页</a></li>
          <li class="page-item active" ><a class="page-link" href="#">1</a></li>
          <li class="page-item" ><a class="page-link" href="#">2</a></li>
          <li class="page-item" ><a class="page-link" href="#">3</a></li>
          <li class="page-item" ><a class="page-link" href="#">下一页</a></li> -->
        </ul>
      </div>
      <table class="table table-striped table-bordered table-hover">
        <thead>
          <tr>
            <th class="text-center" width="40"><input type="checkbox"></th>
            <th>标题</th>
            <th>作者</th>
            <th>分类</th>
            <th class="text-center">发表时间</th>
            <th class="text-center">状态</th>
            <th class="text-center" >操作</th>
          </tr>
        </thead>
        <tbody>

        </tbody>
      </table>
    </div>
  </div>
  <!-- Modal -->
  <div class="modal fade" id="modelId" tabindex="-1" role="dialog" aria-labelledby="modelTitleId" aria-hidden="true">
    <div class="modal-dialog" role="document">
      <div class="modal-content">
          <div class="modal-header">
              <h5 class="modal-title">提示</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
            </div>
        <div class="modal-body">
          <div class="container-fluid">
          确定删除吗？
          </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
          <button type="button" id="delId" class="btn btn-primary">确定</button>
        </div>
      </div>
    </div>
  </div>
  
  <%- include('./layouts/admin_aside.ejs');%>
  <%- include('./layouts/admin_footer');%>
  <script src="/assets/js/admin_posts.js"></script>
  <script src="/assets/vendors/art-template/template-web.js"></script>
  <script id="tp" type="text/template">
   {{ each $data $val }}
      <tr data-id="{{$val.id}}">
        <td class="text-center"><input type="checkbox"></td>
        <td>{{$val.title}}</td>
        <td>{{$val.nickname}}</td>
        <td>{{$val.name}}</td>
        <td class="text-center">{{$val.created}}</td>
        <td class="text-center">
          {{ if ($val.status == 'drafted') }}
                草稿
         {{ else if ($val.status == 'published') }}
              已发布
          {{ else if ($val.status == 'trashed') }}
              已作废
         {{ /if }}
        </td>
        <td class="text-center">
          <a href="/admin/post-add?id={{$val.id}}" class="btn btn-primary btn-xs">编辑</a>
          <a href="javascript:;" class="btn btn-danger btn-xs">删除</a>
        </td>
      </tr>
   {{ /each }}
  </script>
